<?php

namespace RTSCraft\MainBundle\Repository;

use Doctrine\ORM\EntityRepository;

/*
  Custom repository for User entity.
  Returns the unique user stored in the database. Needs to be updated
  if needed.
*/
class UserRepository extends EntityRepository
{
  public function findUser()
  {
    $em = $this->getEntityManager();
    $dql = 'select u FROM RTSCraft\MainBundle\Entity\User u';
    $query = $em->createQuery($dql);
    $query->setMaxResults(1);    /* Only 1 user */
    return $query->getResult();
  }
}
?>
